-- title: landing0
-- author: Will
-- desc: survive as a guy
-- site: website link
-- license: sussybaka
-- version: 1.0
-- script: lua
function GetDistance( x1, y1, x2, y2 )
return math.sqrt( ( x2 - x1 )^2 + ( y2 - y1 )^2 )
end
x = 0; y = 80; s = 2
pd = 1; px = -200; py = -200; pSpr = 39
ex = 200; ey = 100
enemies={
{ x=100,y=100, mapx=0,mapy=0 },
{ x=100,y=100, mapx=30,mapy=0 },
{ x=140,y=110, mapx=30,mapy=0 },
{ x=120,y=120, mapx=30,mapy=0 },
{ x=120,y=120, mapx=60,mapy=0 },
{ x=120,y=120, mapx=60,mapy=0 },
{ x=120,y=120, mapx=60,mapy=0 },
{ x=120,y=120, mapx=90,mapy=0 },
{ x=120,y=120, mapx=90,mapy=0 },
{ x=120,y=120, mapx=90,mapy=0 },
{ x=120,y=120, mapx=120,mapy=0 },
{ x=120,y=120, mapx=120,mapy=0 },
{ x=120,y=120, mapx=120,mapy=0 },
}
leveldata={
{ kills=1 },
{ kills=3 },
{ kills=3 },
{ kills=3 },
{ kills=3 },
{ kills=3 },
{ kills=3 },
{ kills=3 },
{ kills=3 },
{ kills=3 },
}
song=0
mapx=0; mapy=0
music(song)
function TIC()
map(mapx,mapy)
spr(s,x,y,0)
spr(playerSpr, x, y, 0)
spr(pSpr,px,py,0)
lid = math.floor(mapx/30+1)
if leveldata[lid] == nil then
mapx = 0
end
if lid==4 and song==0 then
song=1
music(song)
end
print("Need "..leveldata[lid].kills .. " kills", 5, 5,12)
for id, en in pairs( enemies ) do
if en.mapx == mapx and en.mapy == mapy then
-- Draw enemy
spr(8, en.x, en.y, 0)
-- Vibrate enemy
en.x=en.x+math.random(-1,1)
en.y=en.y+math.random(-1,1)
-- Check bullet
dist = GetDistance(px,py,en.x,en.y)
if dist <= 8 then
en.x = -200
leveldata[lid].kills = leveldata[lid].kills - 1
end
end
end
-- Go to next level?
if leveldata[lid].kills == 0 then
mapx = mapx + 30
end
-- Keyboard movement
if btn(0) then
if y >= 65 then
y=y-1
end
end -- UP
if btn(1) then
y=y+1
end -- DOWN
if btn(2) then
x=x-1
s = 2
end -- LEFT
if btn(3) then
x=x+1
s = 3
end -- RIGHT
-- Shoot projectile
if btn(5) then
pSpr = 37
pd = 3
px = x
py = y
elseif btn(4) then
pSpr = 39
pd = -3
px = x
py = y
end
px = px + pd
end
--
-- 002:0044400000ac4000044444000444440004444400004440000040400000404000
-- 003:000444000004ca00004444400044444000444440000444000004040000040400
-- 008:bbbbbbbbb004400b0014410001244210d124421ddd1221dd00d11d0000dddd00
-- 013:eeeeeeeeeeddddeeededdedeeddeeddeeddeeddeededdedeeeddddeeeeeeeeee
-- 014:8888888888c8888c8888888888888c8888c88888888888888c888c8888888888
-- 015:8888888888888888888888888888888888888888878788787777777777777777
-- 029:8888888888888888888888888888888888888888888888888888888888888888
-- 030:7777777777777777777777777777777777777777777777777777777777777777
-- 031:88888c88c884488c884488888848888888488c8888448888888448888c88888c
-- 032:7777eeee77eedddd7eddcba97ed1dba9edcd2da9edbbd3d9edaaad4ded9999dc
-- 033:eeee7777ddddee779abcdde79abd1de79ad2dcde9d3dbbded4daaadecd9999de
-- 037:0111100012222100123332101234432112344321123332101222210001111000
-- 039:0001111000122221012333211234432112344321012333210012222100011110
-- 045:7777777777777777722222777722277777767777777677777626267777666777
-- 046:ee8998eee89aa98e89abba989abccba99abccba989abba98e89aa98eee8998ee
-- 047:ee1221eee123321e12344321234cc432234cc43212344321e123321eee1221ee
-- 048:ed9999dcedaaad4dedbbd3d9edcd2da97ed1dba97eddcba977eedddd7777eeee
-- 049:cd9999ded4daaade9d3dbbde9ad2dcde9abd1de79abcdde7ddddee77eeee7777
-- 063:deeeeeeded2222dee222222ee224422ee224422ee222222eed2222dedeeeeeed
-- 082:c2c2c2c2221111ccc1c112122112c11cc11c211221211c1ccc1111222c2c2c2c
-- 083:c9c9c9c9998888ccc89889899889c88cc88c98899898898ccc8888999c9c9c9c
-- 086:3334333443444344343334334443444333343334434443443433343344434443
-- 089:0000000000111100002222110333322204443332000444330000044400000044
-- 090:0000000000000000000000001100000022110000322111003322211043332211
-- 093:0000000000000000000000000000001200000122000012330111223401223440
-- 094:0000000000000000000000000000000000000000000000004000000000000000
-- 104:0000000000000000000000010000000100000001000000010000000100000001
-- 105:0000000011111111222222222222222222333333223333332233444422334444
-- 106:4444332211144432222114442222210433332210333332214443332244433333
-- 107:1000000021000000311000004211000043211000043210001443200021440000
-- 108:0000000100000012000012230001223400112340011224000122340111223412
-- 109:1234440024441111440112224012222201223333122333332233344433333444
-- 110:0000000011111111222222222222222233333322333333224444332244443322
-- 111:0000000000000000100000001000000010000000100000001000000010000000
-- 120:0000000100000001000000010000000100000201000002210000002200000222
-- 121:2233444422334444223333332233333322222222222222222222222222002222
-- 122:4443333344433322333332213333221022222100222222001222220022222200
-- 123:2100400010000000000000000000000000000000000000000000000000000000
-- 124:0233441200344001000000000000000000000000000000000000000000000000
-- 125:3333344422333444122333330122333300122222000112220000122200000000
-- 126:4444332244443322333333223333332222222222222222222211221200222222
-- 127:1000000010000000100000001000000010000000220000002200000000000000
-- 136:0000002200000000000000000000000000000000000000000000000000000000
-- 137:0220222200022222000022200000202200002002000020000000220000002200
-- 138:2220000020000001000000120000012320000123200001232000012320000123
-- 139:0000000011000000221000003221000043221111443222220443333300444444
-- 140:0000000000000011000001220000122311112234222223443333344044444400
-- 141:0000000010000000210000003210000032100000321000003210000032100000
-- 142:2222020220020200200222002202200002220000002200000202000022022000
-- 146:0000000000000000000000000000000000000000000000000000000000200000
-- 153:0000220000000200000002000000000000000000000000000000000000002000
-- 154:2000012320000123200001232000012320000123200001232000001220000001
-- 155:000c2c0000022c00000020004444000033334444222233331111222200001111
-- 156:00c2c00000c22000000200000000444444443333333322222222111111110000
-- 157:3210000032100002321000023210000232100002321000022100000210000002
-- 158:2002200020022000000220000002200000022000002220000020200002202000
-- 162:0022222200200002002000000020000000200000002000000020000000200000
-- 163:0000000020000000220000000200000000200000002000000002000000020000
-- 164:0000000000000000000222220020000000000000000000000000000000000000
-- 165:0000000022222200000200220002000000020000000200000002000000020000
-- 166:0000000000000000222200000000000000000000000000000000000000000000
-- 167:0200222202220000020000000200000002000000020000000200000002000000
-- 168:2200000002222000000000000000000000000000000000000000000000000000
-- 169:0000200000002000000020000000200000002000000020000000200000002000
-- 170:2000000002000000020000000200000002000000000000000000000000000000
-- 173:0000000200000002000000020000000000000000000000000000000000000000
-- 174:0200200002020000020200002000000020000000200000002000000020000000
-- 178:0020000000200000002000000020000000200000002000000020000000200000
-- 179:0000200000002000000020000000200000002000000020000000200000002000
-- 181:0002000000020000000200000002000000020000000200000020000000200000
-- 183:0200000002000000022222220200000002000000020000000200000002000000
-- 184:0000000000000000222200000002200000000000000000000000000000000000
-- 185:0000200000002000000020000000200000002000000020000000200000002000
-- 190:2000000000000000000000000000000000000000000000000000000000000000
-- 194:0020000000200000002000000020000000200000002000000020000000200000
-- 195:0000200000002000000020000000200000020000002000000220000022000000
-- 197:0020000000200000002200000002000000020000000200000002000000020000
-- 199:0200000002000000200000002000000020000000200000002000000020000000
-- 201:0000200000002000000020000000200000002000000022000000020000000000
-- 210:0020000200200002002002200022220000000000000000000000000000000000
-- 211:2000000000000000000000000000000000000000000000000000000000000000
-- 212:0000000000000000022000000002222200000000000000000000000000000000
-- 213:0002000000020000000222222222000000000000000000000000000000000000
-- 214:0000000000000000222200000000000000000000000000000000000000000000
-- 215:2222222222000000000000000000000000000000000000000000000000000000
-- 216:2222220000000000000000000000000000000000000000000000000000000000
-- 217:0000000000000000000002000000000000000000000000000000000000000000
--
--
--
-- 000:00000000ffffffff00000000ffffffff
-- 001:0123456789abcdeffedcba9876543210
-- 002:0123456789abcdef0123456789abcdef
--
--
-- 000:000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000302000000000
--
--
-- 000:400006000000000000700006000000900006000000000000800006000000a00006000000000000000000000000600006000000800006000000000000000000000000600006000000c00006000000000000700006000000b00006100000a00006100000100000600006100000900006100000700006100000700006100000700006100000600006100000a00006100000000000100000100000100000100000100000100000100000100000100000100000000000000000100000100000000000
-- 001:400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
--
--
-- 000:100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001100
-- 001:200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002200
--
--
-- 000:1a1c2c5d275db13e53ef7d57ffcd75a7f07038b76425717929366f3b5dc941a6f673eff7f4f4f494b0c2566c86333c57
--